<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      template="/resources/template/TemplateEFP.xhtml"
      xmlns:ice="http://www.icesoft.com/icefaces/component">

         <ui:define name="title">
            <h:outputText value="#{bundle.CreateQuestionnaireTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <ice:form styleClass="jsfcrud_view_form">
                <div id="formCreate">
                    <h:panelGrid columns="2">
                        <h:outputLabel value="#{bundle.CreateQuestionnaireLabel_nom}" for="nom" />
                        <h:inputText id="nom" value="#{questionnaireController.selected.nom}" title="#{bundle.CreateQuestionnaireTitle_nom}" styleClass="color" required="true"/>
                        <h:outputLabel value="#{bundle.CreateQuestionnaireLabel_typeQuestionnaire}" for="typeQuestionnaire" />
                        <h:selectOneMenu id="typeQuestionnaire" value="#{questionnaireController.selected.typeQuestionnaire}" title="#{bundle.CreateQuestionnaireTitle_typeQuestionnaire}" >
                            <f:selectItems value="#{questionnaireController.itemsTypesAvailableSelectMany}"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="#{bundle.CreateQuestionnaireLabel_typeScenario}" for="typeScenario" />
                        <h:selectOneMenu id="typeScenario" value="#{questionnaireController.selected.typeScenario}" title="#{bundle.CreateQuestionnaireTitle_typeScenario}" >
                            <f:selectItems value="#{questionnaireController.scenariAvailableSelectMany}"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="#{bundle.CreateQuestionnaireLabel_apparence}" for="apparence" />
                        <h:selectOneMenu id="apparence" value="#{questionnaireController.selected.apparence}" title="#{bundle.CreateQuestionnaireTitle_apparence}" >
                            <f:selectItems value="#{apparenceController.itemsAvailableSelectMany}"/>
                        </h:selectOneMenu>
                        <h:outputLabel value="#{bundle.CreateQuestionnaireLabel_dateDiffusion}" for="dateDiffusion" />
                        <ice:selectInputDate id="dateDiffusion" value="#{questionnaireController.dateDiffusion}" renderAsPopup="true">

                        </ice:selectInputDate>
                        <h:outputLabel value="#{bundle.CreateQuestionnaireLabel_dateCloture}" for="dateCloture" />
                        <ice:selectInputDate id="dateCloture" value="#{questionnaireController.dateCloture}" renderAsPopup="true">

                        </ice:selectInputDate>
                        <h:outputLabel value="#{bundle.CreateQuestionnaireLabel_listCible}" for="listCible" />
                        <h:panelGroup>
                            <ice:selectOneMenu id="listCible"  value="#{questionnaireController.uneCible}" title="#{bundle.CreateQuestionnaireTitle_listCible}" >
                                <f:selectItems value="#{questionnaireController.listeCibleAvailable}"/>
                            </ice:selectOneMenu>
                            <h:commandButton value="ajouter" action="#{questionnaireController.ajouterCible}" disabled="#{empty questionnaireController.listeCibleAvailable}" />
                            <ice:dataTable value="#{questionnaireController.dtmCibles}" var="cible" border="0" cellpadding="2" cellspacing="0" rules="all" rendered="#{questionnaireController.dtmCibles.rowCount > 0}">
                                <h:column>
                                    <h:outputText value="#{cible.nom} #{cible.prenom}" />
                                </h:column>
                                <ice:column>
                                    <ice:commandButton image="./resources/images/button/cross.png"  action="#{questionnaireController.retirerCible}" >
                                        <f:setPropertyActionListener target="#{questionnaireController.laCible}" value="#{cible}" />
                                    </ice:commandButton>
                                </ice:column>
                            </ice:dataTable>
                        </h:panelGroup>
                        <h:outputLabel value="#{bundle.CreateQuestionnaireLabel_listQuestion}" for="listQuestion" />
                        <h:panelGroup>
                            <ice:selectOneMenu id="listQuestion"  value="#{questionnaireController.uneQuestion}" title="#{bundle.CreateQuestionnaireTitle_listQuestion}" >
                                <f:selectItems value="#{questionnaireController.listeQuestionAvailable}"/>
                            </ice:selectOneMenu>
                            <h:commandButton value="ajouter" action="#{questionnaireController.ajouterQuestion}" disabled="#{empty questionnaireController.listeQuestionAvailable}" />
                            <ice:dataTable value="#{questionnaireController.dtmQuestions}" var="question" border="0" cellpadding="2" cellspacing="0" rules="all" rendered="#{questionnaireController.dtmQuestions.rowCount > 0}">
                                <h:column>
                                    <h:outputText value="#{question.intitule}" />
                                </h:column>
                                <ice:column>
                                    <ice:commandButton image="./resources/images/button/cross.png"  action="#{questionnaireController.retirerQuestion}" >
                                        <f:setPropertyActionListener target="#{questionnaireController.laQuestion}" value="#{question}" />
                                    </ice:commandButton>
                                </ice:column>
                            </ice:dataTable>
                        </h:panelGroup>
                    </h:panelGrid>
                    <br />
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    <h:commandLink action="#{questionnaireController.create}" value="#{bundle.CreateQuestionnaireSaveLink}" />
                    <br />
                    <h:commandLink action="#{questionnaireController.prepareCreate}" value="#{bundle.CreateQuestionnaireTitle}" />
                    <br />
                    <br />
                </div>
            </ice:form>
        </ui:define>
    </ui:composition>


